import { IsString, IsJSON, IsEnum, IsPhoneNumber, Min, Length, IsOptional, IsBoolean, IsNumber, IsNumberString } from 'class-validator';
import { ApiProperty } from '@nestjs/swagger';
import { BaseInfoDto, PaginationDto } from 'src/common/dto/index.dto';

export class CreateDictTypeDto extends BaseInfoDto {
    @ApiProperty({
        required: true,
    })
    @IsString()
    @Length(0, 100)
    name: string;

    @ApiProperty({
        required: true,
    })
    @IsString()
    @Length(0, 100)
    code: string;
}

export class UpdateDictTypeDto extends CreateDictTypeDto {
    @IsNumber()
    id: number;
}

export class ListDictType extends PaginationDto {
    @IsOptional()
    @IsString()
    @Length(0, 100)
    name?: string;

    @IsOptional()
    @IsString()
    @Length(0, 100)
    code?: string;

    @IsOptional()
    @IsString()
    status?: string;
}

export class CreateDictDataDto extends BaseInfoDto {
    @IsString()
    @Length(0, 100)
    parent: string;

    @IsString()
    @Length(0, 100)
    label: string;

    @IsString()
    @Length(0, 100)
    value: string;

    @IsString()
    @Length(0, 100)
    class: string;
}

export class UpdateDictDataDto extends CreateDictDataDto {
    @IsNumber()
    id: number;
}

export class ListDictData extends PaginationDto {
    @IsOptional()
    @IsString()
    @Length(0, 100)
    label?: string;

    @IsOptional()
    @IsString()
    @Length(0, 100)
    parent: string;

    @IsOptional()
    @IsNumberString()
    status?: string;
}
